#include <stdio.h>
#include <math.h>
int main()
{
    double a,c;
    int b,d;
scanf("%lf %d",&a,&b);
    if(b<5){
        if(a<=3){
        c=10;
    }else if(a>3 && a<=10){
        c=10+(a/1-3)*2;
    }else{
        c=24+3*(a/1-10);
    }
}else{if(a<=3){
        c=10+0.4*b;
    }else if(a>3 && a<=10){
        c=10+(a/1-3)*2+0.4*b;
    }else{
        c=24+3*(a/1-10)+0.4*b;
    }

}
d=round(c);
printf("%d",d);
return 0;

}